package com.uphone.magicleafteacher.pro.adapter;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.uphone.magicleafteacher.R;
import com.uphone.magicleafteacher.view.MyBaseViewHolder;
import com.uphone.magicleafteacher.vo.OtherLiveClassBean;

import java.util.List;

/**
 * Time: 2019/10/31
 */
public class MorecourseAdapter extends BaseQuickAdapter<OtherLiveClassBean.LiveClassListBean, MyBaseViewHolder> {
    public MorecourseAdapter(int layoutResId, @Nullable List<OtherLiveClassBean.LiveClassListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull MyBaseViewHolder helper, OtherLiveClassBean.LiveClassListBean item) {
        switch (helper.getAdapterPosition()) {
            case 0:
                helper.getView(R.id.other_courses_type).
                        setBackground(mContext.getResources().
                                getDrawable(R.drawable.item_other_curriculum_notstarted)
                        );
                helper.setText(R.id.other_courses_type, "未开始");
                break;
            case 1:
                helper.getView(R.id.other_courses_type).
                        setBackground(mContext.getResources().
                                getDrawable(R.drawable.item_other_curriculum_begin));
                break;
            default:

//                helper.getView(R.id.by_buy_course).
//                        setBackground(mContext.getResources().getDrawable(R.drawable.shape_rectangle_round_bg_grayc_12));
//                break;
        }
        helper.setText(R.id.text_course, item.getClassName())
                .setText(R.id.tv_time_start, item.getStartTime())
                .setText(R.id.tv_time_end, item.getEndTime())
                .setText(R.id.test_money, item.getMoney()+"")
                .setText(R.id.text_integral, item.getJifen()+"");

    }
//    public MorecourseAdapter() {
//        super(R.layout.item_more_courses);
//    }
//
//    @Override
//    protected void convert(MyBaseViewHolder helper, Object item) {
//        switch (helper.getAdapterPosition()) {
//            case 0:
//                helper.getView(R.id.other_courses_type).
//                        setBackground(mContext.getResources().
//                                getDrawable(R.drawable.item_other_curriculum_notstarted)
//                        );
//                helper.setText(R.id.other_courses_type, "未开始");
//                break;
//            case 1:
//                helper.getView(R.id.other_courses_type).
//                        setBackground(mContext.getResources().
//                                getDrawable(R.drawable.item_other_curriculum_begin));
//                break;
//            default:
//
////                helper.getView(R.id.by_buy_course).
////                        setBackground(mContext.getResources().getDrawable(R.drawable.shape_rectangle_round_bg_grayc_12));
////                break;
//        }
//    }
}
